package com.gainloop.Api;

import org.alexd.jsonrpc.JSONRPCException;
import org.json.JSONException;

import com.gainloop.Api.Entity.Category;

public class Categories extends ApiAbstract {


	public ApiResponseObject<Category> getById(long id) throws JSONRPCException
	{
		try {
			return new ApiResponseObject<Category>(GetClient().callJSONObject("categories.getById", id), Category.class);
		} catch (JSONException e) {
			throw new ApiException("invalid respond");
		}
	}
	
	public ApiResponseArray<Category> getAll() throws JSONRPCException
	{
		try {
			return new ApiResponseArray<Category>(GetClient().callJSONObject("categories.getAll"), Category.class);
		} catch (JSONException e) {
			throw new ApiException("invalid respond");
		}
	}
	
}
